1   /*
2    * Copyright (C) 2011 The Guava Authors
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  
17  package com.google.common.collect;
18  
19  import com.google.common.annotations.Beta;
20  
21  import java.util.Comparator;
22  import java.util.SortedSet;
23  
24  /**
25   * GWT emulation of {@code SortedMultiset}, with {@code elementSet} reduced
26   * to returning a {@code SortedSet} for GWT compatibility.
27   * 
28   * @author Louis Wasserman
29   * @since 11.0
30   */
31  @Beta
32  public interface SortedMultiset<E> extends Multiset<E>, SortedIterable<E> {
33    Comparator<? super E> comparator();
34  
35    Entry<E> firstEntry();
36  
37    Entry<E> lastEntry();
38  
39    Entry<E> pollFirstEntry();
40  
41    Entry<E> pollLastEntry();
42  
43    /**
44     * Returns a {@link SortedSet} view of the distinct elements in this multiset.
45     * (Outside GWT, this returns a {@code NavigableSet}.)
46     */
47    @Override SortedSet<E> elementSet();
48    
49    SortedMultiset<E> descendingMultiset();
50  
51    SortedMultiset<E> headMultiset(E upperBound, BoundType boundType);
52  
53    SortedMultiset<E> subMultiset(E lowerBound, BoundType lowerBoundType,
54        E upperBound, BoundType upperBoundType);
55  
56    SortedMultiset<E> tailMultiset(E lowerBound, BoundType boundType);
57  }